home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 37 / Amiga Format CD37 (1999-02-16)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-03].iso / -screenplay- / shareware / invasionforce / source / misc / makesource.rexx < prev    next >
OS/2 REXX Batch file  |  1999-01-09  |  963b  |  43 lines

  1. /*
  2.    MakeSource.rexx
  3.       convert a binary data file into C source suitable for
  4.       compiling directly into my program
  5. */
  6.  
  7. parse arg filename
  8. if ~open('infile',filename,'r') then do
  9.         say "Sorry, can't read" filename "."
  10.         exit
  11. end
  12. call open('outfile',"T:OUTPUT",'w')
  13. call open('console','*','w')
  14.  
  15. count=0;
  16. call writech('outfile','      ')
  17. datum=readch('infile',2)
  18. say "Working..."
  19. call writech('console','')
  20. do while ~eof('infile')
  21.    if (count>0) then call writech('outfile',',')
  22.    if (count//16==0 & count>0) then do
  23.       call writeln('outfile','')
  24.       call writech('outfile','      ')
  25.       call writech('console',' ')
  26.    end
  27.    mystring='0x'||C2X(datum)
  28.    call writech('outfile',mystring)
  29.    count=count+2
  30.    datum=readch('infile',2)
  31. end
  32.  
  33. call close('infile')
  34. call close('outfile')
  35. call close('console')
  36. say ''
  37.  
  38. address command "copy T:OUTPUT to" filename'.CX'
  39. address command "delete >nil: T:OUTPUT"
  40.  
  41. exit
  42. /* end of listing */
  43.